package com.ad.pet.app.serach.adapter;

import android.support.annotation.Nullable;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ad.pet.R;
import com.ad.pet.models.remote.mall.FilterAttrValue;

import java.util.List;

/**
 * Created by liuyixiang on 2019/9/21.
 */

public class SearchFilterAttrAdapter extends BaseQuickAdapter<FilterAttrValue,BaseViewHolder> {
    public SearchFilterAttrAdapter( @Nullable List<FilterAttrValue> data) {
        super(R.layout.item_filter_atter_item_layout, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, FilterAttrValue item) {
        TextView tv_attr= helper.getView(R.id.tv_attr);
        ImageView iv_filter_chsoe= helper.getView(R.id.iv_filter_chsoe);
        tv_attr.setText(item.getName());
        if (item.getIs_selected()==1){
            tv_attr.setTextColor(mContext.getResources().getColor(R.color.colorAccent));
            tv_attr.setBackgroundResource(R.drawable.shap_atter_chose_bg);
            iv_filter_chsoe.setVisibility(View.VISIBLE);
        }else {
            tv_attr.setTextColor(mContext.getResources().getColor(R.color.black3d));
            tv_attr.setBackgroundResource(R.drawable.shap_filter_unchose_bg);
            iv_filter_chsoe.setVisibility(View.GONE);
        }
    }
}
